package blog.core.util;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class ServiceUtils {

	/**
	 * 过滤HTML标签
	 * @param str 带有HTML标签的内容
	 * @return 过滤后的内容
	 */
	public static String filterHtml(String str) {
		Pattern pattern = Pattern.compile("<([^>]*)>");
		Matcher matcher = pattern.matcher(str);
		StringBuffer sb = new StringBuffer();
		boolean result1 = matcher.find();
		while (result1) {
			matcher.appendReplacement(sb, "");
			result1 = matcher.find();
		}
		matcher.appendTail(sb);
		return sb.toString();
	}
}
